package com.lizhi.updata;

import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;

import com.alibaba.fastjson.JSON;
import com.lizhi.model.GasStationModel;
import com.lowagie.text.BadElementException;
import com.lowagie.text.Image;

public class GasStationData {
	private String host = "https://freebook.firebaseio.com/gastations.json";

	public GasStationData() {

		try {
			GasStationModel gasStationModel = new GasStationModel();
			gasStationModel.id = String.valueOf(System.currentTimeMillis());
			gasStationModel.img = "http://img03.taobaocdn.com/imgextra/i3/63644127/TB2wjEucFXXXXXTXpXXXXXXXXXX_!!63644127.jpg";
			Image img = Image.getInstance(new URL(gasStationModel.img));
			gasStationModel.width = String.valueOf(img.width());
			gasStationModel.height = String.valueOf(img.height());
			gasStationModel.brief = "推广";
			gasStationModel.time = String.valueOf(System.currentTimeMillis());
			gasStationModel.detail = "http://tt.alimama.com/rmact/ylp.html?pid=mm_32040768_8916298_30138995";

			new UploadDataTask("https://freebook.firebaseio.com/gastations.json", JSON.toJSONString(gasStationModel)).start();

		} catch (BadElementException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (MalformedURLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}

	public static void main(String[] args) {
		new GasStationData();
	}
}
